package org.wangzx.framework.security.controller;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.wangzx.framework.security.constant.SecurityConstant;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by WangZX on 2018/7/11.
 */
@RestController
public class DefaultSecurityController {

    @GetMapping(SecurityConstant.DEFAULT_UNAUTHENTICATION_URL)
    @ResponseStatus(code = HttpStatus.UNAUTHORIZED)
    public Object requireAuthentication(HttpServletRequest request, HttpServletResponse response)
            throws IOException {
        Map result = new HashMap();
        result.put("message","用户未登录！");
        return result;
    }
}
